package com.ruoyi.order.service.impl;

import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Function;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.order.domain.app.Vo.NoticeVo;
import org.springframework.stereotype.Service;
import com.ruoyi.order.mapper.NoticeMapper;
import com.ruoyi.order.domain.Notice;
import com.ruoyi.order.service.INoticeService;
import com.ruoyi.common.core.text.Convert;

import javax.annotation.Resource;

/**
 * 通知表Service业务层处理
 *
 * @author ruoyi
 * @date 2022-02-04
 */
@Service
public class NoticeServiceImpl implements INoticeService {
    @Resource
    private NoticeMapper noticeMapper;

    /**
     * 查询通知表
     *
     * @param noticeID 通知表主键
     * @return 通知表
     */
    @Override
    public Notice selectNoticeByNoticeID(Integer noticeID) {
        return noticeMapper.selectNoticeByNoticeID(noticeID);
    }

    /**
     * 查询通知表列表
     *
     * @param notice 通知表
     * @return 通知表
     */
    @Override
    public List<Notice> selectNoticeList(Notice notice) {
        return noticeMapper.selectNoticeList(notice);
    }

    /**
     * 新增通知表
     *
     * @param notice 通知表
     * @return 结果
     */
    @Override
    public int insertNotice(Notice notice) {
        notice.setCreateTime(DateUtils.getNowDate());
        return noticeMapper.insertNotice(notice);
    }

    /**
     * 修改通知表
     *
     * @param notice 通知表
     * @return 结果
     */
    @Override
    public int updateNotice(Notice notice) {
        notice.setUpdateTime(DateUtils.getNowDate());
        return noticeMapper.updateNotice(notice);
    }

    /**
     * 批量删除通知表
     *
     * @param noticeIDs 需要删除的通知表主键
     * @return 结果
     */
    @Override
    public int deleteNoticeByNoticeIDs(String noticeIDs) {
        return noticeMapper.deleteNoticeByNoticeIDs(Convert.toStrArray(noticeIDs));
    }

    /**
     * 删除通知表信息
     *
     * @param noticeID 通知表主键
     * @return 结果
     */
    @Override
    public int deleteNoticeByNoticeID(Integer noticeID) {
        return noticeMapper.deleteNoticeByNoticeID(noticeID);
    }

    @Override
    public List<NoticeVo> getNotices() {
        QueryWrapper<Notice> wrapper = new QueryWrapper<>();

        Map<String,Object> map = new HashMap<>();
        map.put("state",0);
        List<NoticeVo> list = noticeMapper.getNotices(map);
        return list;
    }

    @Override
    public boolean saveBatch(Collection<Notice> entityList, int batchSize) {
        return false;
    }

    @Override
    public boolean saveOrUpdateBatch(Collection<Notice> entityList, int batchSize) {
        return false;
    }

    @Override
    public boolean updateBatchById(Collection<Notice> entityList, int batchSize) {
        return false;
    }

    @Override
    public boolean saveOrUpdate(Notice entity) {
        return false;
    }

    @Override
    public Notice getOne(Wrapper<Notice> queryWrapper, boolean throwEx) {
        return null;
    }

    @Override
    public Map<String, Object> getMap(Wrapper<Notice> queryWrapper) {
        return null;
    }

    @Override
    public <V> V getObj(Wrapper<Notice> queryWrapper, Function<? super Object, V> mapper) {
        return null;
    }

    @Override
    public BaseMapper<Notice> getBaseMapper() {
        return null;
    }

    @Override
    public Class<Notice> getEntityClass() {
        return null;
    }
}
